package bigPack.service.impl;


import bigPack.dao.UserDao;
import bigPack.dao.impl.UserDaoImpl;
import bigPack.pojo.user;
import bigPack.service.UserService;

public class UserServiceImpl implements UserService {

    private UserDao userDao=new UserDaoImpl();
    @Override
    public void registeUser(user user) {
        userDao.saveUser(user);
    }

    @Override
    public user login(user user) {
        return userDao.queryUserByUsernameAndPassword(user.getUsername(),user.getPassword());
    }

    @Override
    public boolean existsUsername(String username) {
        /*查询用户 结果 不为空 =》  存在该用户*/
        System.out.println("username:"+username);
        System.out.println(userDao.queryUserByUsername(username));

        if(userDao.queryUserByUsername(username)!=null){
           return true;
       }
       return false;
    }
}
